<div class="action-block is-rounded" data-test-disable-replication>
  <div class="action-block-info">
    <h4 class="title is-5 is-marginless">
      Disable Replication
    </h4>
    <p>
      Disable {{model.replicationModeForDisplay}} Replication entirely on the cluster.
    </p>
  </div>

  <div class="action-block-action">
    <button
      type="button"
      class="button is-danger"
      onclick={{action (mut isModalActive) true}}
      data-test-replication-action-trigger
    >
      Disable Replication
    </button>
  </div>
</div>

<ConfirmationModal
  @title="Disable Replication?"
  @onClose={{action (mut isModalActive) false}}
  @isActive={{isModalActive}}
  @confirmText={{model.replicationModeForDisplay}}
  @toConfirmMsg="disabling {{model.replicationModeForDisplay}} Replication on this cluster"
  @onConfirm={{action
    "onSubmit"
    "disable"
    (if
      (eq model.replicationAttrs.modeForUrl 'bootstrapping')
      mode
      model.replicationAttrs.modeForUrl
    )
  }}
  @testSelector="disable"
>
  <p class="has-bottom-margin-m">
    {{#if (and model.replicationAttrs.isPrimary (eq model.replicationMode "dr"))}}This cannot be undone. {{/if}}
    Disabling {{model.replicationModeForDisplay}} Replication entirely on this {{if (eq model.replicationAttrs.isPrimary true) "primary" "secondary"}} cluster means that:
  </p>
  <ul class="bullet">
    {{#if model.replicationAttrs.isPrimary}}
    <li>Secondaries will no longer be able to connect</li>
    <li>We will wipe the underlying storage of connected secondaries</li>
    <li>Secondaries connecting back to the cluster will require a wipe of the underlying storage</li>
    {{else}}
    <li>We will wipe the underlying storage of this secondary when connected to a primary</li>
    {{/if}}
    <li>Re-enabling this node will change its cluster ID</li>
  </ul>
</ConfirmationModal>
